<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>智能终端</title>
    <!-- Bootstrap -->
    <link href="./libs/bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- <link href="./libs/bootstrap-switch.min.css" rel="stylesheet"> -->
    <style type="text/css">
         body {
            background: url("./image/bg.png") center center no-repeat;
        }

        input:focus {
            border: 0;
        }

        .col-sm-5 {
            padding-right: 0;
            padding-left: 0;
        }

        .nav-tabs {
            border-bottom: none;
        }

        .bootstrap-switch {
            border-radius: 15px;
        }

        .bootstrap-switch .bootstrap-switch-handle-on {
            border-bottom-left-radius: 15px;
            border-top-left-radius: 15px;
        }

        .panel {
            /*margin-top: 25px;*/
            background: rgba(255, 255, 255, 0.30);
            height: 338px;
            margin-bottom: 0;
            border-radius: 0;
            margin-left: 1px;
        }

        .panel-heading {
            padding: 20px 15px;
            font-size: 22px;
        }

        .panel-body {
            padding: 30px 15px;
            color: #fff;
        }

        .panel-default {
            border-color: #b6b6b7;
            border: none;
        }

        .panel-default>.panel-heading {
            background-color: rgba(255, 255, 255, 0);
            border-color: rgba(255, 255, 255, 0.30);
            border-bottom: 0px solid rgba(255, 255, 255, 0.30);
            ;
            border-top-left-radius: 0;
            border-top-right-radius: 0;
            color: #fff;
        }

        .button {
            background-color: #444648;
            color: #fff;
            border: none;
        }

        .button:hover {
            background-color: #F1C30C;
        }

        .button:focus {
            border-color: #F1C30C;
            background-color: none;
        }

        .btn-warning.active,
        .btn-warning:active,
        .open>.dropdown-toggle.btn-warning {
            background-color: #fad029;
        }

        .btn-warning.active:hover {
            background-color: #F1C30C;
        }

        .btn-group-sm>.btn,
        .btn-sm {
            background: none;
            border: 1px solid #333;
            color: #fff;
        }

        .clear {
            clear: both;
        }

        .switch-box {
            width: 142px;
            margin: 0 auto;
        }

        .switch-box .switch {
            /*width: 100px;*/
            background-image: url("./image/default.png");
            float: left;
            width: 71px;
            height: 40px;
        }

        .switch-box .open {}

        .switch-box .col,.switch-box .hand-col {
            background-position: -71px 0px;
        }
        .nav-tabs .active a {
            background: -webkit-linear-gradient(#EFD50E, #EF970E);
            /* Safari 5.1 - 6.0 */
            background: -o-linear-gradient(#EFD50E, #EF970E);
            /* Opera 11.1 - 12.0 */
            background: -moz-linear-gradient(#EFD50E, #EF970E);
            /* Firefox 3.6 - 15 */
            background: linear-gradient(#EFD50E, #EF970E);
            /* 标准的语法（必须放在最后） */
        }

        .nav-tabs>li.active>a {
            color: #333;
        }

        .nav-tabs>li>a {
            border-radius: 0;
            padding: 15px 15px;
            color: #fff;
        }
        .nav-tabs>li>a:hover {
            background-color: #EFD50E;
        }

        .nav-tabs {
            background: linear-gradient(#4A4948, #060606);
            width: 976px;
        }
        
    </style>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <nav class="navbar navbar-default" role="navigation" style="background-color:#fad029;padding: 10px 0;">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <a class="navbar-brand" href="#" style="color: #0E0E0E;font-weight: bold;font-size:22px;">东仪电子液体肥配肥机控制终端（测试）</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li style="margin-top: 10px;font-size: 20px;"><i class="glyphicon glyphicon-cog"></i></li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container-fluid -->
    </nav>

    <div class="container">
        <div class="row">
            <ul class="nav nav-tabs" id="nav-tabs" role="tablist">
                <li role="presentation" class="active"><a href="javascript:void(0)">自动模式</a></li>
                <li role="presentation"><a href="javascript:void(0)">手动模式</a></li>
            </ul>
        </div>
        <div class="row" id="tab-box">
            <div class="tab-content">
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">氮肥流量</div>
                        <div class="panel-body">
                            <div class="row" style="padding-left: 52px;margin-top:40px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>预设流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-warning minus"><i class="glyphicon glyphicon-minus"></i></button>
                                        <input type="text" id="flo1-text" class="btn btn-warning flo-text" name="data" style="width:50px;" value="0">
                                        <button type="button" class="btn btn-warning plus"><i class="glyphicon glyphicon-plus"></i></button>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row" style="padding-left: 52px;margin-top:20px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>当前流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" id="current-flowA" class="btn btn-warning" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <!-- <div class="row text-center" style="margin-top:20px;">
                            <div class="switch-box">
                                <div class="open switch"></div>
                                <div class="col switch"></div>
                                <div class="clear">

                                </div>
                            </div>
                        </div> -->
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">磷肥流量</div>
                        <div class="panel-body">
                            <div class="row" style="padding-left: 52px;margin-top:40px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>预设流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-warning minus"><i class="glyphicon glyphicon-minus"></i></button>
                                        <input type="text" id="flo2-text" class="btn btn-warning flo-text" name="data" style="width:50px;" value="0">
                                        <button type="button" class="btn btn-warning plus"><i class="glyphicon glyphicon-plus"></i></button>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row" style="padding-left: 52px;margin-top:20px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>当前流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" id="current-flowB" class="btn btn-warning" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <!-- <div class="row text-center" style="margin-top:20px;">
                            <div class="switch-box">
                                <div class="open switch"></div>
                                <div class="col switch"></div>
                                <div class="clear">

                                </div>
                            </div>
                        </div> -->
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">钾肥流量</div>
                        <div class="panel-body">
                            <div class="row" style="padding-left: 52px;margin-top:40px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>预设流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-warning minus"><i class="glyphicon glyphicon-minus"></i></button>
                                        <input type="text" id="flo3-text" class="btn btn-warning flo-text" name="data" style="width:50px;" value="0">
                                        <button type="button" class="btn btn-warning plus"><i class="glyphicon glyphicon-plus"></i></button>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row" style="padding-left: 52px;margin-top:20px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>当前流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" id="current-flowC" class="btn btn-warning" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <!-- <div class="row text-center" style="margin-top:20px;">
                            <div class="switch-box">
                                <div class="open switch"></div>
                                <div class="col switch"></div>
                                <div class="clear">

                                </div>
                            </div>
                        </div> -->
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">总流量</div>
                        <div class="panel-body">
                            <div class="row" style="padding-left: 52px;margin-top:38px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>配肥总流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" class="btn btn-warning" id="total-flow" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row text-center" style="margin-top:20px;">
                                <div class="switch-box">
                                    <div class="open switch"></div>
                                    <div class="col switch"></div>
                                    <div class="clear">

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
            </div>
            <div class="tab-content hide">
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">氮肥流量</div>
                        <div class="panel-body">
                            <!-- <div class="row" style="padding-left: 52px;margin-top:40px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>预设流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-warning"><i class="glyphicon glyphicon-minus"></i></button>
                                        <input type="text" class="btn btn-warning" style="width:50px;" value="0">
                                        <button type="button" class="btn btn-warning"><i class="glyphicon glyphicon-plus"></i></button>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div> -->
                            <div class="row" style="padding-left: 52px;margin-top:20px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>当前流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" class="btn btn-warning" id="hand-flo1-text" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row text-center" style="margin-top:20px;">
                            <div class="switch-box">
                                <div class="switch hand-open" hand="true" index="1"></div>
                                <div class="switch hand-col"  hand="true" index="1"></div>
                                <div class="clear">

                                </div>
                            </div>
                        </div>
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">磷肥流量</div>
                        <div class="panel-body">
                            <!-- <div class="row" style="padding-left: 52px;margin-top:40px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>预设流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-warning"><i class="glyphicon glyphicon-minus"></i></button>
                                        <input type="text" class="btn btn-warning" style="width:50px;" value="0">
                                        <button type="button" class="btn btn-warning"><i class="glyphicon glyphicon-plus"></i></button>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div> -->
                            <div class="row" style="padding-left: 52px;margin-top:20px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>当前流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" class="btn btn-warning" id="hand-flo2-text" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row text-center" style="margin-top:20px;">
                            <div class="switch-box">
                                <div class="switch hand-open" hand="true" index="2"></div>
                                <div class="switch hand-col"  hand="true" index="2"></div>
                                <div class="clear">

                                </div>
                            </div>
                        </div>
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
                <div class="col-sm-5 col-md-5">
                    <div class="panel panel-default">
                        <div class="panel-heading text-center">钾肥流量</div>
                        <div class="panel-body">
                            <!-- <div class="row" style="padding-left: 52px;margin-top:40px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>预设流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <button type="button" class="btn btn-warning"><i class="glyphicon glyphicon-minus"></i></button>
                                        <input type="text" class="btn btn-warning" style="width:50px;" value="0">
                                        <button type="button" class="btn btn-warning"><i class="glyphicon glyphicon-plus"></i></button>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div> -->
                            <div class="row" style="padding-left: 52px;margin-top:20px;">
                                <div class="col-sm-5 col-md-4 text-right" style="padding-top: 5px;">
                                    <span>当前流量：</span>
                                </div>
                                <div class="col-sm-5 col-md-5">
                                    <div class="btn-group btn-group-sm">
                                        <input type="text" class="btn btn-warning" id="hand-flo3-text" style="width:117px;" value="0" readonly>
                                        <span style="font-size:18px;display: inline-block;margin-left:10px;margin-top:5px;color:#333;">L</span>
                                    </div>
                                </div>
                            </div>
                            <div class="row text-center" style="margin-top:20px;">
                            <div class="switch-box">
                                <div class="hand-open switch" hand="true" index="3"></div>
                                <div class="hand-col switch"  hand="true" index="3"></div>
                                <div class="clear">

                                </div>
                            </div>
                        </div>
                        </div>
                    </div>
                    <div class="col-sm-2 col-md-2">
                    </div>
                </div>
            </div>

        </div>
        <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
        <script src="./libs/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
        <script src="./libs/bootstrap-switch.min.js"></script>
        <script type="text/javascript">
           var isOpenA=true;  //设备1是否流尽标示
           var isOpenB=true;  //设备2是否流尽标示
           var isOpenC=true;  //设备3是否流尽标示
           var isOpen=true;   //总开关标示
           //计算总流量值
           function getFlow(){
          		var flo1=parseFloat($("#current-flowA").val());
            	var flo2=parseFloat($("#current-flowB").val());
            	var flo3=parseFloat($("#current-flowC").val());
                $("#total-flow").val(flo1+flo2+flo3);
             }
           function getFlowA(){       	
        		 $.post("./getCurrentFlow.do",{"id":1,"isAuto":1},function(data){
        			 var code=data.code;
        			 if(isOpen){
        				  /*  var flo1=parseInt($("#flo1-text").val());
        				   var result=parseInt(data.result)
                           var dValue=Math.abs(flo1-result);
        				 if(flo1==0||dValue<5){ */
        					 if(data.code==1){
        						 $("#current-flowA").val(data.result); 
        					 }
        				// }  		
        				 getFlowB();
        				 setTimeout(getFlowA(),500);
        			 }/* else if(code==-1&&isOpen){
        				 setTimeout(getFlowA(),500);
        			 } */
        		 });       	  
           }
           function getFlowB(){       	
      		 $.post("./getCurrentFlow.do",{"id":2,"isAuto":1},function(data){
      			 var code=data.code;
      			 if(isOpen){
      				/*  var flo1=parseInt($("#flo2-text").val());
  				   	 var result=parseInt(data.result)
                     var dValue=Math.abs(flo1-result);
	  				 if(flo1==0||dValue<5){ */
	  					 if(data.code==1){
	      					$("#current-flowB").val(data.result); 
	  					 }
	  				// }
	  				getFlow(); 
      				/*  setTimeout(getFlowB(),500); */
      			 }/* else if(code==-1&&isOpen){
    				 setTimeout(getFlowB(),500);
    			 } */
      		 });       	  
         }
           function getFlowC(){       	
        		 $.post("./getCurrentFlow.do",{"id":3,"isAuto":1},function(data){
        			 var code=data.code;
        			 if(isOpen){
        				 /* var flo1=parseInt($("#flo3-text").val());
      				   	 var result=parseInt(data.result)
                         var dValue=Math.abs(flo1-result);
	      				 if(flo1==0||dValue<5){ */
	      					 if(data.code==1){
	        					$("#current-flowC").val(data.result); 
	      					 }
	      					//getFlow(); 
	      				// }
        				/*  setTimeout(getFlowC(),500); */
        			 }/* else if(code==-1&&isOpen){
        				 setTimeout(getFlowC(),500);
        			 } */
        		 });       	  
           }
           //自动模式下  开阀
            $(".open").click(function() {
            	var $this=$(this);
            	var flo1=$(".flo1-text").val();
            	var flo2=$(".flo2-text").val();
            	var flo3=$(".flo3-text").val();
            	if(flo1!=0&&flo2!=0&&flo3!=0){
            		//发送预设流量
            		var data=$(".flo-text").serialize();
            		$.post("./order.do",data,function(data){
            			$.post("./startAll.do",{},function(data){
                			if(data.code==1){
                				$this.parent().find(".switch").css("background-image", 'url("./image/open.png")');
                				isOpen=true;
                				getFlowA();
                				  /* getFlowB();
                				getFlowC();  */
                				//getFlow(); 
                			}else{
                				alert("打开失败");
                			}
                		});
            		});
            	}else{                                                      
            		alert("请设置预设值！")
            	}
            });
          //自动模式下  关阀
            $(".col").click(function() {
            	var $this=$(this);
        			$.post("./stopAll.do",{},function(data){
            			 if(data.code==1){
            				 isOpen=false;
            				$this.parent().find(".switch").css("background-image", 'url("./image/close.png")');
            			}else{
            				alert("关闭失败");
            			} 
            		});
               
            });

            $("#nav-tabs li").click(function() {
                var index = $(this).index();
                $("#nav-tabs li").removeClass("active").eq(index).addClass("active");
                $("#tab-box .tab-content").addClass("hide").eq(index).removeClass("hide");
            });
            
            
          //手动模式下  开阀
             $(".hand-open").click(function() {
            	var $this=$(this);
            	var index=$this.attr("index");
            		$.post("./start.do",{id:index},function(data){
            			if(data.code==1){
            				$this.parent().find(".switch").css("background-image", 'url("./image/open.png")');
            				if(index==1){
            					isHandOpenA=true;
            					getHandFlowA()
            				}else if(index==2){
            					isHandOpenB=true;
            					getHandFlowB()
            				}else if(index==3){
            					isHandOpenC=true;
            					getHandFlowC()
            				}
            			}else{
            				alert("开阀失败");
            			}
            		});
            });
             //手动模式下  关阀
             $(".hand-col").click(function() {
             	var $this=$(this);
             	var index=$this.attr("index");
             		$.post("./stop.do",{id:index},function(data){
             			if(data.code==1){
             				$this.parent().find(".switch").css("background-image", 'url("./image/close.png")');
             				if(index==1){
             					isHandOpenA=false;
            				}else if(index==2){
            					isHandOpenB=false;
            				}else if(index==3){
            					isHandOpenC=false;
            				}
             			}
             		});
             });
             var isHandOpenA=true;
             var isHandOpenB=true;
             var isHandOpenC=true;
             
             function getHandFlowA(){
            		 $.post("./getCurrentFlow.do",{"id":1,"isAuto":2},function(data){
            			 var code=data.code;
            			 console.log(code)
            			 if(code==1&&isHandOpenA){
            				/*  var flo1=parseInt($("#hand-flo1-text").val());
          				   	 var result=parseInt(data.result)
                             var dValue=Math.abs(flo1-result);
          				   		if(flo1==0||dValue<5){ */
           					 	$("#hand-flo1-text").val(data.result);
   	      				      //  } 
          				   	   	      				 
            				 setTimeout(getHandFlowA(),500);
            			 }else if(code==-1&&isHandOpenA){
            				 setTimeout(getHandFlowA(),500);
            			 }
            		 });            	            	  
               }
             function getHandFlowB(){            	             	  
            		 $.post("./getCurrentFlow.do",{"id":2,"isAuto":2},function(data){
            			 var code=data.code;
            			 if(code==1&&isHandOpenB){
            				 /* var flo1=parseInt($("#hand-flo2-text").val());
          				   	 var result=parseInt(data.result)
                             var dValue=Math.abs(flo1-result);
    	      				 if(flo1==0||dValue<5){ */
            				 	$("#hand-flo2-text").val(data.result); 
    	      				// }
            				 setTimeout(getHandFlowB(),500);
            			 }else if(code==-1&&isHandOpenB){
            				 setTimeout(getHandFlowB(),500);
            			 }
            		 });
            	  
               }
             function getHandFlowC(){
            		 $.post("./getCurrentFlow.do",{"id":3,"isAuto":2},function(data){
            			 var code=data.code;
            			 if(code==1&&isHandOpenC){
            				/*  var flo1=parseInt($("#hand-flo3-text").val());
          				   	 var result=parseInt(data.result)
                             var dValue=Math.abs(flo1-result);
    	      				 if(flo1==0||dValue<5){ */
            				 	$("#hand-flo3-text").val(data.result); 
    	      				// }
            				 setTimeout(getHandFlowC(),500);
            			 } else if(code==-1&&isHandOpenC){
            				 setTimeout(getHandFlowC(),500);
            			 }
            		 });
            	  
               }
             
             
            //预设流量加减
            $(".minus").click(function() {
                var $input = $(this).siblings("input");
                var num = parseInt($input.val());
                if (num != 0) {
                    num -= 1;
                    $input.val(num);
                }
            });
            $(".plus").click(function() {
                var $input = $(this).siblings("input");
                var num = parseInt($input.val());
                num += 1;
                $input.val(num);
            });
           /*  $(".plus").siblings("input").keyup(function(){
            	var $input = $(this);
            	var num=$input.val(); 
                var reg = new RegExp("^-?[0-9]*.?[0-9]*$");
                if ( reg.test(num) ) {
                	 num=parseInt(num);
                    var absVal = Math.abs(num);
                    if(num==absVal){
                    	console.log("yes");
                    }else{
                    	$input.val(0);	 
                    	alert("请输入正整数");
                    }
                }else{
                	$input.val(0);	 
                	alert("请输入合法数字");
                }
            }); */
        </script>    
</body>

</html>
